<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="./vue2.js"></script>
<style>
    .hotpink{
        background-color: hotpink;
    }
    .green{
        background-color: green;
    }
</style>
<body>
    <span>333</span>
    <div class="box" :class="witchColor?'hotpink':'green'">
        {{myname}}
        <button @click="handleClick()">click</button>
    <img :src="imagepath"/>
    <ul v-show="listitem" v-for="item in list">
        <li>{{item}}</li>
    </ul>
    </div>
    <script>
        new Vue({
            el:".box",
            data:{
                myname:'kerwin',
                witchColor:true,
                imagepath:'',
                list:['aaa','bbb','ccc'],
                listitem:false

            },
            methods:{
                handleClick(){
                    //这个this代表的是这个Vue的实例new Vue({el:".box",data:{myname:'kerwin'}
                    console.log(111,this);
                   this.myname='chodidi';
                   this.witchColor=false;
                   this.listitem=true;
                   this.imagepath='//i2.hdslb.com/bfs/archive/2e20f95da4cbc6d4ec84ce24e01499973c7ebbd4.jpg@672w_378h_1c'
                }
               
            }
        })
    </script>
</body>
</html>